﻿using System;
using System.Web.UI;
using System.Collections.ObjectModel;
using Highcharts.Core;
using Highcharts.Core.Data.Chart;
using Highcharts.Core.PlotOptions;

namespace DemoWebforms
{
    public partial class Sample06 : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Exemplo06();
        }

        private void Exemplo06()
        {

            hcVendas.Title = new Title("Browsers dos visitantes de um site qualquer");

            //dados
            var series = new Collection<Serie>();
            series.Add(new Serie
            { size = 130,
                data = new object[] { 
                    new object[] { "Firefox", 45 }, 
                    new object[] { "IE", 24.8 }, 
                    new object[] { "Chrome", 12.8 },
                    new object[] { "Safari", 8.5 }, 
                    new object[] { "Opera", 5.2 }, 
                    new object[] { "Outros", 3.7 } 
                }
            });

            hcVendas.PlotOptions = new PlotOptionsPie 
            { 
                allowPointSelect = true, cursor = "pointer", 
                dataLabels = new DataLabels { enabled = true }                
            };

            hcVendas.Tooltip = new ToolTip("'<b>'+ this.point.name +'</b>: '+ this.y +' %'");
            hcVendas.Theme = "pink-floral";            
            
            //bind do controle
            hcVendas.DataSource = series;
            hcVendas.DataBind();

        }
    }
}